home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / xmasspak / dosdir / dd.asm next >
Encoding:
Assembly Source File  |  1996-02-24  |  5.8 KB  |  227 lines

  1. ;-----------------------------------------
  2. ; Universal Dos Routine (UDR)
  3. ;
  4. ; (c) 09.94 by Capella/Escape
  5. ;
  6. ; NOT FOR RELEASE !!!
  7. ;-----------------------------------------
  8. ; routine searching for max. 200 names
  9. ; needs 3531 Bytes of Data-segment
  10. ;-----------------------------------------
  11.  
  12. ideal
  13. model large
  14. p386n
  15. stack 256
  16.  
  17. assume cs:coding
  18.  
  19. segment coding
  20.  
  21. max_files  = 200
  22.                 
  23. anti_virus      db "ESCAPE"
  24.                 
  25. start:          mov ax,data1
  26.                 mov ds,ax
  27.                 assume ds:data1
  28.  
  29.                 mov eax,[cs:0000]        ;checks if program is changed
  30.                 cmp eax,"ACSE"
  31.                 je virusc1
  32. virusc2:        mov ah,09h
  33.                 mov dx,offset virus_mess
  34.                 int 21h
  35.                 jmp exit
  36. virusc1:        mov ax,[cs:0004]
  37.                 cmp ax,"PE"
  38.                 je virusc2
  39.                 
  40.                 mov dx,offset dir_puffer   ;set pointer to new DTA-puffer
  41.                 mov ax,1a00h
  42.                 int 21h
  43.                 
  44.                 call ask_drive
  45.                 
  46.                 xor dl,dl
  47.                 mov di,offset path_sign
  48.                 call ask_path
  49.                 
  50.                 xor cx,cx
  51.                 mov dx,offset search_name
  52.                 call ask_files
  53.                 
  54.                 call display_dir
  55.  
  56.  
  57. warte:          in al,60h
  58.                 cmp al,01h
  59.                 jne warte
  60.  
  61. exit:           mov ax,4c01h
  62.                 int 21h
  63.  
  64.  
  65.  
  66. ;-----------------------------------------
  67. ; ASK_DRIVE
  68. ;
  69. ; OUT:  AL : 0= Drive A
  70. ;            1= Drive B
  71. ;            2= Drive C
  72. ;            3= Drive D
  73. ;            4= Drive E
  74. ;-----------------------------------------
  75. ask_drive:      mov ax,1900h
  76.                 int 21h
  77.  
  78.                 cmp al,0
  79.                 jne ad1
  80.                 mov [ds:drive_no],"A"
  81.                 ret
  82. ad1:            cmp al,1
  83.                 jne ad2
  84.                 mov [ds:drive_no],"B"
  85.                 ret
  86. ad2:            cmp al,2
  87.                 jne ad3
  88.                 mov [ds:drive_no],"C"
  89.                 ret
  90. ad3:            cmp al,3
  91.                 jne ad4
  92.                 mov [ds:drive_no],"D"
  93.                 ret
  94. ad4:            cmp al,4
  95.                 jne ad5
  96.                 mov [ds:drive_no],"E"
  97.                 ret
  98. ad5:            mov [ds:drive_no],"?"
  99.                 ret
  100. ;-----------------------------------------
  101. ; ASK_PATH
  102. ;
  103. ; IN:   DS:DI = FAR-Pointer to Puffer
  104. ;       DL    = Drive : 0= current Drive
  105. ;                       1= Drive A
  106. ;                       2= Drive B
  107. ;                       3= Drive C
  108. ;                       4= Drive D
  109. ;                       5= Drive E
  110. ;
  111. ; OUT:  Carry-Flag= 1 then AX= Errorcode
  112. ;-----------------------------------------
  113. ask_path:       mov ax,4700h
  114.                 int 21h
  115.                 jnc ap1
  116.                 mov [ds:error_code],ax
  117. ap1:            ret
  118. ;-----------------------------------------
  119. ; ASK_FILES
  120. ;
  121. ; IN:  DS:DX = FAR-Pointer of Filename to search for
  122. ;      CX    = Attribute of File to search for
  123. ;
  124. ; OUT: Carry-Flag=1 then AX= Errorcode
  125. ;-----------------------------------------
  126. ask_files:      xor bp,bp               ;file-pointer to zero
  127.                 mov di,offset file_size
  128.                 mov si,offset dir_puffer
  129.                 xor ax,ax
  130.                 mov cx, max_files*13*4/2  ;clear file_size
  131. af3:            mov [ds:di],ax
  132.                 add di,02h
  133.                 loop af3
  134.                 mov di,offset file_size
  135.                 mov cx,000010b
  136.                 mov ax,4e00h
  137.                 int 21h
  138.                 jnc af1
  139.                 mov [ds:error_code],ax
  140. af2:            mov [ds:real_files],bp
  141.                 ret
  142. af1:            call get_para
  143.                 inc bp
  144.                 cmp bp,max_files
  145.                 jae af2
  146.                 mov ax,4f00h
  147.                 int 21h
  148.                 jnc af1
  149.                 mov [ds:error_code],ax
  150.                 mov [ds:real_files],bp
  151.                 ret
  152.                 
  153. get_para:       push si           ;get filename
  154.                 push di                          
  155.                 xor cx,cx
  156. af5:            mov al,[ds:si+30]
  157.                 cmp al,0
  158.                 je af4
  159.                 mov [ds:di],al
  160.                 inc si
  161.                 inc di
  162.                 inc cx
  163.                 cmp cx,13
  164.                 je af4
  165.                 jmp af5
  166. af4:            pop di            ;get filesize
  167.                 pop si
  168.                 add di,13
  169.                 mov eax,[ds:si+26]
  170.                 mov [ds:di],eax
  171.                 add di,4
  172.                 ret
  173. ;-----------------------------------------
  174. display_dir:    mov ax,0b800h
  175.                 mov es,ax
  176.                 assume es:0b800h
  177.                 xor bx,bx
  178.                 xor bp,bp
  179.                 xor di,di
  180.                 mov si,offset file_size
  181.  
  182. dd2:            push si
  183.                 push di
  184.  
  185.                 mov cx,13
  186. dd1:            mov al,[ds:si]
  187.                 mov [es:di],al
  188.                 inc si
  189.                 add di,02
  190.                 loop dd1
  191.  
  192.                 pop di
  193.                 pop si
  194.                 add si,13+4
  195.                 add di,160
  196.  
  197.                 inc bp
  198.                 cmp bp,[ds:real_files]
  199.                 je dd3
  200.                 
  201.                 inc bx
  202.                 cmp bx,80
  203.                 jne dd2
  204. dd3:            ret
  205.  
  206. ends coding
  207.  
  208.  
  209. segment  data1
  210.  
  211. virus_mess  db 13,10,"- ATTENTION !!! ORIGINAL FILE IS CHANGED....MAYBE VIRUS !!!"
  212.             db 13,10,"  PLEASE CHECK YOUR SYSTEM !!!!!",13,10,"$"
  213.  
  214. dir_puffer  db 43 dup (0)
  215. error_code  dw 00
  216. search_name db "*.asm",0
  217. real_files  dw 00
  218. drive_no    db 0
  219. path_sign   db 80 dup (0)
  220. file_size   db max_files*13 dup (0)
  221.             db max_files*4 dup (0)
  222.  
  223. ends  data1
  224.  
  225. end start
  226.  
  227.